package com.simple.dbrouter.controller;

import com.simple.dbrouter.entity.User;
import com.simple.dbrouter.mapper.UserMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 功能描述:
 *
 * @author: WuChengXing
 * @create: 2021-12-30 11:05
 **/
@RestController
public class UserController {

    private Logger logger = LoggerFactory.getLogger(UserController.class);

    @Resource
    private UserMapper userMapper;

    @GetMapping("/api/queryUserInfoById")
    public User queryUserInfoById(@RequestParam("userId") String userId) {
        return userMapper.queryUserInfoByUserId(new User(userId));
    }

    @PostMapping("/api/addUser")
    public String addUser(@RequestBody User user) {
        userMapper.insertUser(user);
        return "success";
    }
}
